import os
import numpy as np


class RecordPath:
    base_project_dir_path = os.path.dirname(os.path.dirname(__file__))
    recorded_state_dir_path = os.path.join(*[base_project_dir_path, 'tempdir', 'recorded_states'])

    dir_path__analysis_result = os.path.join(*[base_project_dir_path, 'tempdir', 'analysis_result'])

    dir_path__abs_mouse = os.path.join(*[recorded_state_dir_path, 'abs_mouse'])
    dir_path__key = os.path.join(*[recorded_state_dir_path, 'key'])
    dir_path__rel_mouse = os.path.join(*[recorded_state_dir_path, 'rel_mouse'])
    dir_path__screen_image = os.path.join(*[recorded_state_dir_path, 'screen_image'])


class DefaultArgs:
    """
    全局变量
    """
    record_path = RecordPath()

    frames = 30
    # mouse_move_speed = 1
    mouse_move_speed = 5
    key__click_mouse_left = 'numpad_0'
    key__shift_mouse_speed = 'decimal_key'

    key__mouse_speed_dc = {
        'slow': 'numpad_7',
        'normal': 'numpad_8',
        'quick': 'numpad_9',
    }

    max_record_time = 60 * 5
    min_record_time = 1.5
    record_time_schedule = np.round(np.arange(min_record_time, max_record_time, 1 / frames), 3)

    # use_sleep_wait = False  # 阻塞式运行, 不用sleep可以保证录制帧时间的准确性, 但会导致卡顿
    use_sleep_wait = True  # 阻塞式运行, 不用sleep可以保证录制帧时间的准确性, 但会导致卡顿

    # --- flags ---
    flag__exit = False

    flag__start_screen_record = False
    flag__stop_screen_record = False


if __name__ == '__main__':
    print(len(DefaultArgs.record_time_schedule))

    1 * 60 * DefaultArgs.frames

    pass